package cn.wizzer.app.user.modules.models;

import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author zl
 * @date 2020/8/7 15:19
 */
@Table("user_rebate")
@TableIndexes({@Index(name = "unique_no", fields = {"no"}),
        @Index(name = "INDEX_USER_ID", fields = {"fromUser","toUser"}, unique = false)})
@Data
public class UserRebate extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    @Column
    @Comment("操作用户")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String fromUser;

    @Column
    @Comment("发放用户")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String toUser;

    @Column
    @Comment("操作金额")
    @ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
    @Default("0")
    private BigDecimal oprMoney;

    @Column
    @Comment("发放金额")
    @ColDefine(type = ColType.FLOAT, width = 10, precision = 2)
    @Default("0")
    private BigDecimal rebateMoney;

    @Column
    @Comment("关联等级")
    @ColDefine(type = ColType.INT,width = 4,notNull = true)
    private Integer relationLevel;

    @Column
    @Comment("操作订单")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String orderId;

    @Column
    @Comment("创建时间")
    private Long ctAt;

}
